package com.randy.fundation;

import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class Safe {
    static public <t> t val(@Nullable t v, @NonNull t defaultValue) {
        if (v == null) {
            return defaultValue;
        }
        return v;
    }

    static public String notEmpty(@Nullable String v, @NonNull String defaultValue) {
        if (TextUtils.isEmpty(v)) {
            return defaultValue;
        }
        return v;
    }
}
